home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / dfs236s.zip / DFS.DOC < prev    next >
Text File  |  1997-08-20  |  62KB  |  1,333 lines

  1.  
  2.    Display File Systems; version 2.36 20-08-97  (c) 1994-1997; Jan van Wijk
  3.  ════════════════════════════════════════════════════════════════════════════
  4.  
  5. CONTENTS
  6. --------
  7.  Introduction, purpose of the program                                    1
  8.  Status of the program and change history                                2
  9.  Terminology used                                                        3
  10.  Summary of commands                                                     5
  11.  Command reference, general DFS commands                                 6
  12.  Command reference, HPFS specific commands                              18
  13.  Diagram of an example HPFS structure                                   22
  14.  Examples of DFS usage                                                  23
  15.  Known limitations                                                      24
  16.  Considered improvements                                                24
  17.  
  18.  
  19.  
  20.  
  21. Introduction, purpose of the program
  22. ------------------------------------
  23.  
  24.  The DFS program is a disk and filesystem browser with an emphasis on the
  25.  HPFS filesystem and disk partitioning.
  26.  It will support different file-systems besides HPFS in the near future.
  27.  
  28.  The program has been built while studying the HPFS filesystem.
  29.  It's main purpose is getting to understand the file-system as it resides
  30.  on the disk itself, in the data-structures laid down in disk-sectors.
  31.  Over time, additional logic was implemented to allow analysis of all
  32.  sorts of disk problems on HPFS volumes.
  33.  The tool has been used a few times over the past years to analyse some
  34.  real-life disk problems in a large systems-integration project.
  35.  Also it has proven very usefull in teaching others the internals of HPFS
  36.  Most of my knowledge of the file-system is based on the excellent lectures
  37.  "HPFS Internals" at the 1994, 95 and 96 ColoradOS/2 conferences by
  38.  Doug Azzarito and on peeking arround on a lot of HPFS volumes using DFS.
  39.  
  40.  Further improvements will probably be in more advanced recovery commands
  41.  and other filesystems like FAT and NTFS.
  42.  Also a port to NT itself is finished and under test right now.
  43.  
  44.  
  45. Availability
  46. ------------
  47.  
  48.  1) IBM internal: REQUEST DFS FROM NLX0093 at EAMSVM1
  49.  
  50.  2) Compuserve:   GO OS2BVEN, open Filemanagers library section;  DFS.ZIP
  51.  
  52.  3) HOBBES (WWW): ftp://hobbes.nmsu.edu/pub/os2/util/diskutil/DFSxxxS.ZIP
  53.     or shadow:    ftp://ftp.cdrom.com/pub/os2/util/diskutil/DFSxxxS.ZIP
  54.  
  55.  You can also download this and some other software and information from
  56.  my homepage at Compuserve:
  57.  
  58.                          http://ourworld.compuserve.com/homepages/jvwijk
  59.  
  60.  On special (e-mail) request a 16-bit OS/2 and tracing/debug versions and
  61.  the (beta) Win NT version are also available.
  62.  
  63.                                                                               
  64. Status of the program
  65. ---------------------
  66.  
  67.  This version of the program is free for anyone to use, it was written
  68.  in my own time using my own equipment.
  69.  
  70.  However, I would very much appreciate any feedback by e-mail or a simple
  71.  postcard to:
  72.                             ┌───────────────────┐
  73.                             │  Jan van Wijk     │
  74.                             │  Blekerstraat 83  │
  75.                             │  1315 AC  Almere  │
  76.                             │  Netherlands      │
  77.                             └───────────────────┘
  78.  
  79.  If you supply an e-mail address you will be put on the DFS mailing-list.
  80.  
  81.  
  82.  Further development depends on my own needs and feedback I receive from
  83.  other users, al work has to be done on spare time...
  84.  Improved versions of the program might be in the form of SHAREWARE.
  85.  
  86.  Suggestions and other comments regarding DFS and filesystems are welcome.
  87.  
  88.  You can reach me at my userid at CompuServe: 100603,2437 or jvwijk
  89.  
  90.                      or through the Internet: jan.van.wijk@cmg.nl
  91.                                           or: jvwijk@compuserve.com
  92.                                           or: janvw@ibm.net
  93.  
  94.  
  95.  
  96. Change History
  97. --------------
  98. 1.00  27-11-94     DHPFS initial version, hex dump super+spare blocks
  99. 1.39  20-07-95     32-bit port; Sector Lookup table; bug-fixes
  100. 1.52  13-09-95     new '/' cmd shortcut; First released version!     <== BBS
  101. 1.56  26-09-95     RUN cmd runs REXX dhpfs macro's
  102. 1.62  13-10-95     Added Free-space and inconsistency reporting
  103. 1.64  16-10-95     Cleanup for delivery on ColoradOS/2 CDROM
  104. 1.69  24-06-96     Fixed trap on non-HPFS volumes (open FAT, Enter ==> trap)
  105. 1.70  20-12-96     Update ColoradOS/2, DASD limits; REQUESTABLE (OS2FISYS forum)
  106. 1.84  14-01-97     DFS first distributed version to include partitioning info
  107. 1.87  19-01-97     Fixed MBR/EBR walk; multiple cmds using #, BM-labels in part
  108. 1.90  20-01-97     New fixroot and saveto commands for recovery actions (KULVM)
  109. 1.91  21-01-97     New fixcp command to fix CodePage reference          (KULVM)
  110. 1.96  27-01-97     Dynamic loading of REXX support
  111. 2.00  03-02-97     Removable media (NEWDASD); (part) D: cmd; invisible primary
  112. 2.01  06-02-97     CopyOutput command for REXX
  113. 2.06  16-03-97     Updated ACL support on HPFS386; Scan badsectors
  114. 2.08  25-03-97     Added cluster/bytes-per-sector knowledge for partitions
  115. 2.12  06-04-97     Added logical volume support using "DASD" type access
  116. 2.20  19-05-97     Win NT beta version; Search speedup; prio command; cleanup
  117. 2.22  28-05-97     Final preparation for other file-system support; cleanup
  118. 2.24  10-06-97     Added Img and Sim commands; date/time on dirblocks;
  119. 2.25  15-06-97     Added Wrim command; Improved lock implementation (nested)
  120. 2.27  19-06-97     Base cmd; Fixed bug in HPFS "saveto" cmd
  121. 2.28  21-06-97     Added autobase command for HPFS (find HPFS partition start)
  122. 2.29  29-06-97     Fixed Bootmgr clustersize; added Deleted Fnode/Alloc support
  123. 2.30  06-07-97     Improved 'find' syntax and functionality; Undelete support
  124. 2.31  13-07-97     Fixed case-insensitive find, '+' option; fix dirmap % error
  125. 2.32  20-07-97     Reporting & ALBLK fixes to saveto; new "ca" cmd CheckAlloc
  126. 2.33  27-07-97     Fnode & Alloc display update; minor fixes
  127. 2.35  18-08-97     Path info in Fnode display and "list" output; MEM cmd
  128. 2.36  20-08-97     Path display on find Fnode;
  129.                                                                               
  130. Terminology used
  131. ----------------
  132.  
  133.  Sector         512 bytes of data
  134.                 This is the smallest amount of data manipulated by the
  135.                 disk subsystems and is also the basic allocation-unit
  136.                 for the HPFS file-system
  137.  
  138.  CHS            Cylinder Head Sector (addressing)
  139.                 This is the classical way of addressing physical sectors
  140.                 on a disk. It is used in the PC's BIOS, in partition tables
  141.                 and in low-level disk-IO API's (IOCTL, INT-13).
  142.                 In most implementations the addressing ranges are limitted
  143.                 causing all sorts of problems with large disks/partitions.
  144.                 Example: maximum cylinder=1024 limit for BIOS/INT-13
  145.  
  146.  PSN            Physical Sector Number
  147.                 This is the zero-based, unsigned-LONG, number for a
  148.                 sector on a physical disk. Addressing on a disk using
  149.                 PSN's id often referred to as Relative Block Addressing
  150.                 (RBA) or Logical Block Addressing (LBA)
  151.  
  152.  LSN            Logical Sector Number
  153.                 This is the zero-based, unsigned-LONG, number for a
  154.                 sector on a logical partition. The partition can be seen
  155.                 as a linear sequence of sectors.
  156.  
  157.  SLT            Sector/Cluster Lookup Table
  158.                 An array of information about sectors or groups of sectors,
  159.                 containing the type of the sector(s) and the LSN of a
  160.                 directly related sector (usualy an Fnode).
  161.                 It is currently implemented for HPFS only.
  162.  
  163.  Cluster        A (small) group of adjecent sectors that are handled by the
  164.                 operating system as one allocation-unit.
  165.                 It is used on FAT filesystems to allow large partitions at
  166.                 the cost of more wasted "slack" space, and on NTFS to balance
  167.                 performance, slack-space etc.
  168.                 HPFS does not use sector-clustering (or a cluster-size of 1!)
  169.  
  170.                 DFS will try to account for clustering where needed, for
  171.                 example in size calculations and where sector/cluster pointers
  172.                 are used in the file-system internal structures.
  173.  
  174.                                                                               
  175.  
  176.  Partition      An area on a physical disk that holds a single logical
  177.                 file-system like FAT, HPFS, Boot-manager, NTFS etc.
  178.                 There is an index to find partitions in the form of a
  179.                 set of partition-tables in the MBR/EBR chain.
  180.  
  181.  MBR            Master Boot Record
  182.                 The first sector on the physical disk, located at PSN 0 =
  183.                 Cylinder 0, Head 0, Sector 1
  184.                 It contains the initial boot code called from the BIOS and
  185.                 the main partition table that holds the primary partitions
  186.                 and the start of the chain of extended boot records (EBR).
  187.  
  188.  EBR            Extended Boot Record
  189.                 It contains no boot code but only a partition table that
  190.                 holds the location of a single logical partitions.
  191.                 It usualy is located on the cylinder just before the actual
  192.                 logical partition itself, at Head 0, Sector 1.
  193.                 Each EBR will also point to the next EBR if more logical
  194.                 partitions exist on the same disk.
  195.  
  196.  Volume         A logical volume as seen by the active operating system,
  197.                 with a logical drive-letter associated to it.
  198.                 It can be either a hard-disk partition with a filesystem
  199.                 recognized and mounted by the operating system, or some
  200.                 other storage-medium like floppy disk or CD-Rom.
  201.                 Note: Network drives or other "virtual" file-systems can also
  202.                       be refered to as volumes. However, DFS will not be able
  203.                       to access them because such devices usualy cannot be
  204.                       accessed using "open volume" (DASD) methods.
  205.  
  206.  Shortname      The leading part of a filename, as contained in an HPFS fnode
  207.                 and usefull for undelete. The maximum length is 15 characters
  208.  
  209.                                                                               
  210. Summary of commands
  211. -------------------
  212.  
  213.  DFS takes commands from the keyboard and displays the results to the screen,
  214.  scrolling text upward. It can also be copied to a file for later analysis.
  215.  
  216.  The commands are single words or (hexadecimal) numbers.
  217.  Most commands have one or more parameters of wich some are optional.
  218.  
  219.  DFS keeps track of the current- and some other usefull SN's so they
  220.  can be referenced faster, without having to type them in. They are:
  221.  
  222.      Name          Cmd       Description
  223.      ----          ---       -----------
  224.      up            'u'       up in hierarchy
  225.      down          Enter     down in hierarchy
  226.      this          't'       this (current)
  227.      xtra          'x'       Extra, alternative
  228.  
  229.  You can display and analyse either a physical disk, a partition or a volume.
  230.  A physical disk can be opened using the 'disk' command.
  231.  
  232.  A logical-partition or volume needs to be opened first with the 'part' or
  233.  'vol' commands respectively. The following prompt will show some status info.
  234.  After opening an HPFS partition, using 'Enter' a few times will take you
  235.  to the superblock, root-directory, possible sub-directories upto some file.
  236.  
  237.  Multiple commands can be chained if separated with the '#' character.
  238.  
  239.  An overview of the available commands is given below, it can also be
  240.  referenced from within the program using the '?' command.
  241.  
  242.  ??               = Show active filesystem name, commands and help info
  243.  ???              = Show all recognized sector-types for current filesystem
  244.  part [dr/nr][No] = Show partitions,  or select one using nr or drive-letter
  245.  vol  [drive][No] = Show all volumes, or select one using drive-letter
  246.  im   img         = Open a file with a FS-image (.img) for display & analysis
  247.  sim  img [f [s]] = Save to FS-image, starting from LSN [f], size [s] sectors
  248.  wrim img [f [s]] = Write FS-image to disk-sectors start at LSN [f], size [s]
  249.       xx          = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  250.  H,h  xx   [size] = Hex-dump sector or half-sector, SN xx, s sectors or bytes
  251.  t a|h     [size] = This SN, display in Ascii/Hexadecimal, s sectors or bytes
  252.  .NNN    [listid] = Display numbered FS-entity marked .NNN from a sector list
  253.  list [listid][+] = Display LSN's in sector list, id = Dir, Alloc, Bad or Find
  254.  SLT  [type i ln] = Display SLT for sectors of 'type' at index i, ln lines
  255.  id          [xx] = Identify current or specified sector, using the SLT
  256.  f[op] [t] [str]] = Find [options] sectors of [t]ypes containing [str]
  257.       options are : * = repeat; - = backward; $ = Ign-case; @[pos] = position
  258.  Enter, u, x      = Show next with <Enter>, up with 'u' or extra LSN with 'x'
  259.  walk    [disknr] = Select a physical disk and walk the MBR/EBR chain
  260.  scan [wr [NoId]] = Scan bad-sectors; use read/Write verify; No automatic id
  261.  log       [file] = Log (append) to 'file' (.log); (No file => stop logging)
  262.  run macro        = Run a DFS macro in a REXX .cmd file
  263.  q                = Quit FS display; 2.36 20-08-97  (c) 1994-1997; Jan van Wijk
  264.  
  265.  EXTERNALS      Any command not recognized as a valid DFS internal command
  266.                 will be passed to the default command-processor (COMSPEC).
  267.                 Usefull commands: CHKDSK, CD, DIR, ...
  268.                 Note: FDISK, SETBOOT etc will not work if a physical disk
  269.                 is currently opened by DFS itself.
  270.                                                                               
  271. Command reference, general DFS commands
  272. ---------------------------------------
  273.  
  274.  
  275.  disk [nr]    = Select specified physical disk for physical addressing
  276.  
  277.  Purpose:       Select a physical disk
  278.  
  279.  Parameters:    nr      optional   Physical disk number, default is 1
  280.  
  281.  Output:        Disk Geometry and default display of sector 0 (usualy MBR)
  282.  
  283.                 The returncode (rc) will be zero for a valid disk number
  284.                 or equal to the number of disks otherwise.
  285.                 This can be usefull from REXX scripts.
  286.  
  287.  
  288.  walk [nr]    = Walk the MBR/EBR chain of partition-tables for specified disk
  289.  
  290.  Purpose:       Show all partitioning information for the specified disk
  291.  
  292.  Parameters:    nr      optional   Physical disk number, default is 1
  293.  
  294.  Output:        Disk Geometry, MBR and all linked EBR's in partition format
  295.  
  296.  
  297.  lock         = Lock physical disk, to allow writing to it (fixroot)
  298.  
  299.  Purpose:       Lock a physical disk
  300.  
  301.  Parameters:    none
  302.  
  303.  Output:        none
  304.  
  305.  
  306.  unlock       = Unlock physical disk, after writing to it (fixroot)
  307.  
  308.  Purpose:       Unlock a physical disk
  309.  
  310.  Parameters:    none
  311.  
  312.  Output:        none
  313.  
  314.                                                                               
  315.  part [i][ns] = Select specified partition, or show the list of partitions
  316.  
  317.  Purpose:       Select a disk partition for analysis
  318.  
  319.  Parameters:    i       optional   Number specifying the partition as shown
  320.                                    by the 'disks' or 'part' commands
  321.                         or   d:    Drive-letter for a partition (part C:)
  322.                         or   +     To get a verbose list
  323.                         or   !     To force a new scan of physical disks
  324.                                    If no parameter is specified the list of
  325.                                    partitions will be displayed.
  326.  
  327.                 ns      optional   Do not start SLT thread automaticaly (HPFS)
  328.                                    When specified, the SLT will be build later
  329.                                    when the 'SLT' cmd is issued to display it.
  330.  
  331.  Output:        Either the list of partitions or the default display for the
  332.                 first sector of the partition (usualy a boot-sector).
  333.  
  334.  Remarks:       The command "d:" where d is any existing drive-letter will
  335.                 be interpreted as a "part d:" command. This means that the
  336.                 C: partition can be opened just by typing "C:"
  337.  
  338.                 The returncode (rc) will be zero for a valid partition id
  339.                 or equal to the number of partitions otherwise.
  340.                 This can be usefull from REXX scripts.
  341.  
  342.                 An example of the list ouput in table form (default) is:
  343.  
  344.  Opened phys. disk : 1          Cyl: 327 H: 64 S:32            Size:   327.0 Mb
  345.  Number of physical disks found: 1
  346.  ┌──┬──┬──┬─────────────────┬────────┬────────┬───────────┬────────┬─────────┐
  347.  │id│PD│Dr│Type, description│Format  │Creator │Label Info │BM-Name │ Size Mb │
  348.  ├──┼──┼──┼─────────────────┼────────┼────────┼───────────┼────────┼─────────┤
  349.  │01│ 1│--│Prim 0a Boot Mgr │FAT     │        │«OS/2    » │        │     1.0 │
  350.  │02│ 1│C:│Prim 07 Inst. FS │HPFS    │OS2 20.0│OS2        │OS/2    │   170.0 │
  351.  │03│ 1│D:│Log  07 Inst. FS │HPFS    │OS2 20.0│OS2        │STARTUP │     5.0 │
  352.  │04│ 1│E:│Log  07 Inst. FS │HPFS    │OS2 20.0│OS2        │        │   145.0 │
  353.  │05│ 1│--│Hide fe PS/2 syst│FAT16   │IBM  5.y│6M OPEN 525│        │     6.0 │
  354.  └──┴──┴──┴─────────────────┴────────┴────────┴───────────┴────────┴─────────┘
  355.  
  356.  Number of physical disks   = The number of disks reported by the system
  357.  Opened phys disk ...       = opened disk with Cylinder, Head, Sector and Size
  358.  Part nn WARNING: ...       = Any informal, strange or alarming conditions
  359.  
  360.  Where:   id                = The selection-id used by DFS for this partition
  361.           PD                = Physical drive number; 1..max
  362.           Dr                = Drive letter, a capital plus a semicolon (C:),
  363.                               or a lowercase drive-letter for hidden partitions
  364.           Type, description = Type-info and hex value of the type, type-info:
  365.                               Prim = Primary (active, accessible)
  366.                               Hide = Hidden  (primary or special)
  367.                               Log  = Logical volume in an extended partition
  368.           Format            = The filesystem format string found in the
  369.                               bootrecord for this partition or --none--
  370.           Creator           = The OEM identification string from the bootrec
  371.                               of "fdisk" if no valid bootrecord is found
  372.           Label Info        = The volumelabel as found in the bootrecord, or
  373.                               the «BM-label» of the current Bootmgr selection
  374.                               Note: The FAT volume-label will not be shown here
  375.           BM-Name           = The name for this partition as registered in
  376.                               the OS/2 boot-manager information area's
  377.           Size Mb           = The gross size of the partition in megabytes
  378.                                                                               
  379.  vol [letter] = Select specified logical volume, or show the list of volumes
  380.  
  381.  Purpose:       Work with logical volumes including floppies and CD-rom
  382.  
  383.  Parameters:    Drive-letter for the volume
  384.  
  385.  Output:        Either the list of volumes or the default display for the
  386.                 first sector of the volume (usualy a boot-sector).
  387.  
  388.  Remarks:       Network or other "virtual" file-systems are not supported.
  389.  
  390.  
  391.  im   img         = Open a file with a FS-image (.img) for analysis
  392.  
  393.  Purpose:       Work with a saved binary image
  394.  
  395.  Parameters:    img     Filename for the image, default extention is '.img'
  396.  
  397.  Output:        The default display for the first sector of the image
  398.  
  399.  Remarks:       File-system type is derived from first (boot) sector
  400.  
  401.  
  402.  sim  img [f [s]] = Save FS-image (.img) start from LSN [f], size [s] sectors
  403.  
  404.  Purpose:       Save specified sectors as a binary image for use with 'IM'
  405.  
  406.  Parameters:    img     Filename for the image, default extention is '.img'
  407.                 f       Start LSN for save, default is 0
  408.                 s       Size of the saved image in sectors, default is 256
  409.                         '$' can be used to save all sectors of the disk/volume
  410.  
  411.  Output:        none
  412.  
  413.  Remarks:       When '.' is specified for s, sector 'f' upto 'this' is saved
  414.                 When '.' is specified for f, the start-sector is 'this'
  415.                 When '.' is specified for both, only the 'this' sector is saved
  416.  
  417.  
  418.  wrim img [f [s]] = Write FS-image to disk-sectors start at LSN [f], size [s]
  419.  
  420.  Purpose:       Write sectors back from an image to opened partition or volume
  421.  
  422.  Parameters:    img     Filename for the image, default extention is '.img'
  423.                 f       Start LSN for write, default is 0
  424.                 s       Size of the written sector area, default size of image
  425.  
  426.  Output:        none
  427.  
  428.  Remarks:       '.' can be specified for the f and s parameters, see 'sim' cmd
  429.  
  430.  
  431.  fs  fs-name [No] = Force analysis using specified file-system knowledge
  432.  
  433.  Purpose:       Use specific FS knowledge if the default is not correct
  434.  
  435.  Parameters:    fs-name File-system name, like FAT or HPFS
  436.                 No      Do not try to build SLT automatically
  437.  
  438.  Output:        none
  439.  
  440.  Remarks:       Only HPFS is realy supported at the moment, and depending on
  441.                 disk or image contents DFS might behave strangely or even trap
  442.                                                                               
  443.  
  444.  base [sn [sl]]   = Set base limits start and end values, defining partition
  445.  
  446.  Purpose:       Force a different partition start sector-nr
  447.  
  448.  Parameters:    sn      Sector-number to use as start for partition ==> LSN 0
  449.                 sl      Sector-number to use as end for partition (optional)
  450.  
  451.  Output:        none
  452.  
  453.  Remarks:       Can be used if start of partition / partition-tables are bad
  454.                 Try to find the PSN for the first sector of the partition
  455.                 and use the "base" cmd followed by an "FS xxxx" command
  456.  
  457.  
  458.  PSN  xx      = Analyse & display sector using PSN xx
  459.  
  460.  
  461.  Purpose:       Display sector using Physical Sector Number addressing
  462.  
  463.  Parameters:    xx = 1 to 8 hexadecimals
  464.  
  465.  Output:        Sector display, format selected based on sector-contents
  466.  
  467.  Remarks:       The SN is specified in hexadecimal format, however the first
  468.                 digit needs to be decimal to avoid misinterpretation.
  469.                 Prefixing the SN with '0' will avoid any conflicts.
  470.  
  471.                 Output that scrolls of the screen can be repeated using
  472.                 the 't' command. (display 'this' sector)
  473.  CHS c  h  s  = Analyse & display sector using CHS specication
  474.  
  475.  
  476.  Purpose:       Display sector using Cylinder, Head and Sector addressing
  477.  
  478.  Parameters:    c       mandatory  The zero-based decimal Cylinder number
  479.                                    Range 1 to disk-specific maximum and
  480.                                    usualy below 1024.
  481.  
  482.                 h       mandatory  The zero-based decimal Head number
  483.                                    Range 0 to disk-specific maximum but
  484.                                    never more than 255
  485.  
  486.                 s       mandatory  The one-based decimal Sector number
  487.                                    Range 1 to disk-specific maximum but
  488.                                    never more than 63
  489.  
  490.  Output:        Sector display, format selected based on sector-contents
  491.  
  492.  Remarks:       Output that scrolls of the screen can be repeated using
  493.                 the 't' command. (display 'this' sector)
  494.                                                                               
  495.  
  496.       xx      = Analyse & display sector, SN xx; xx = 1 to 8 hexadecimals
  497.  
  498.  
  499.  Purpose:       Display a sector in the most usefull format
  500.  
  501.  Parameters:    none
  502.  
  503.  Output:        Sector display, format selected based on sector-contents
  504.  
  505.  Remarks:       The SN is specified in hexadecimal format, however the first
  506.                 digit needs to be decimal to avoid misinterpretation.
  507.                 Prefixing the SN with '0' will avoid any conflicts.
  508.  
  509.                 Logical addressing (LSN) is actualy used, however when a
  510.                 physical disk is selected the offset for logical addressing
  511.                 is set to 0. The result is that LSN's equal PSN's.
  512.  
  513.                 Output that scrolls of the screen can be repeated using
  514.                 the 't' command. (display 'this' sector)
  515.  
  516.  
  517.  
  518.  H,h [xx [s]] = Hex-dump sector or half-sector, LSN xx, s sectors/bytes
  519.  
  520.  Purpose:       Display current or specified sector in hex-dump format
  521.  
  522.  Parameters:    xx      optional   LSN of sector to dump
  523.  
  524.                 s       optional   size to dump:  1..63   specifies sectors
  525.                                                  64..xxx  specifies bytes
  526.                                    Default is 512 bytes for the 'H' command
  527.                                           and 256 bytes for the 'h' command
  528.  
  529.  Output:        Hex-dump of the sector
  530.                 On every line 16 bytes of data will be displayed, each line
  531.                 containing:
  532.                   - the relative offset in the record (4 hex digits)
  533.                   - 16 bytes in hexadecimal; separator after 8 bytes
  534.                   - the same 16 bytes represented as ASCII
  535.  
  536.  Remarks:       The ASCII representation is filtered, non-printable
  537.                 characters are represented with a PERIOD character
  538.  
  539.  
  540.  
  541.  t a|h [s]    = This LSN, display in Ascii or Hex;  s sectors/bytes
  542.  
  543.  Purpose:       Display current sector in ASCII, EA, HEX or default format
  544.  
  545.  Parameters:    a|h     optional   Specifies display format as:
  546.                                       a = ASCII
  547.                                       h = HEX
  548.                                    none = default (based on sector-contents)
  549.  
  550.                 s       optional   size to dump:  1..63   specifies sectors
  551.                                                  64..xxx  specifies bytes
  552.  
  553.  Output:        Sector display in requested format
  554.  
  555.  Remarks:
  556.  
  557.                                                                               
  558.  f[op] [t] [str]] = Find [options] sectors of [t]ypes containing [str]
  559.  
  560.  Purpose:       Perform a sector search starting from the current LSN
  561.                 until a sector of the specified type and optionaly
  562.                 containing a specified ASCII/HEX string is found.
  563.  
  564.  Parameters:    op      optional   Search options, default is '+'
  565.                                    *      = automatic repeat (find all ...)
  566.                                    +      = verbose output even when repeating
  567.                                    -      = search towards lower sector numbers
  568.                                    !      = force LSN/PSN display, no file-paths
  569.                                    $      = Use case-insensitive string compare
  570.                                    @[pos] = compare at one sector position [pos]
  571.                                             (with type dependant defaults)
  572.  
  573.                                    Note: Use no spaces betwee 'f' and options!
  574.  
  575.                 t       optional   Types of sector wanted, default is any KNOWN
  576.                                    specify multiple types in a single string
  577.  
  578.                     DFS generic sector types
  579.                     '*' = any sector
  580.                     'r' = Master   Boot Rec    'e' = Extended Boot Rec
  581.                     'b' = Fsys boot sector     'R' = Fsys reserved sec
  582.                     '!' = any known type       'u' = Unidentified data
  583.                     '$' = Free space           '.' = <Past-partition!>
  584.  
  585.                     HPFS specific sector types
  586.                     'I' = File data            'E' = EA data
  587.                     'A' = ACL data             'B' = Boot area
  588.                     's' = HPFS superblock      'p' = HPFS spareblock
  589.                     'H' = Hotfix table         'h' = Hotfix data
  590.                     'x' = Bad sector-list      'X' = Bad sector
  591.                     'S' = Spare dirblocks      'D' = Directory fnode
  592.                     'f' = Fnode for a file     'z' = Fnode deleted
  593.                     'a' = Allocation block     'Z' = All-block deleted
  594.                     'd' = Directory block      'P' = Dir-band (free)
  595.                     'Q' = Dir-band bitmap      'c' = Codepage info
  596.                     't' = Codepage data        'i' = HPFS386 User-id
  597.                     'm' = Bitmap Tables        'M' = Bitmap data
  598.  
  599.                     For an up-to-date list, use the '???" command
  600.  
  601.                 str     optional   A string of bytes that have to be present
  602.                                    in the wanted sector.
  603.                                    When the '$' string option is not given, it
  604.                                    can be specified as a mix of ASCII and HEX.
  605.                                    The starting mode is ASCII, switching to
  606.                                    HEX and back is done with the ' character.
  607.                                    Leading whitespace is skipped, in HEX mode
  608.                                    spaces can be used to improve readability.
  609.  
  610.                         Example 1: last'0d0a'first
  611.  
  612.                                    This will search for the word "last"
  613.                                    followed by a carriage-return line-feed
  614.                                    combination and the word first
  615.  
  616.                         Example 2: 'e9bd13 0d4023 49 42 4d 3a38 2e'
  617.  
  618.                                    This will search for a byte sequence,
  619.                                    in this case the start of COMMAND.COM
  620.                                                                               
  621.  
  622.  
  623.  Output:        Sector display, format selected based on sector-contents,
  624.                 or a single line with position and type info when repeating
  625.  
  626.  
  627.  Remarks:       This command is also very usefull to find a specific fragment
  628.                 of disassembled code anywhere on the disk, to resolve the
  629.                 name of an EXE, DLL or device driver causing traps or hangs.
  630.  
  631.                 Backward search can be usefull on HPFS to find the preceding
  632.                 fnode when looking at some random file-data.
  633.                 Note: the 'id' command will do this more reliably but depends
  634.                       on the sector-lookup-table to be filled.
  635.  
  636.  
  637.  list  [id][opts] = Display LSN's in sector list, id = Dir, Alloc, Bad or Find
  638.  
  639.  Purpose:       Display one of the sector-number lists maintained by DFS
  640.  
  641.  Parameters     id      optional   Identifier for LSN list, valid values are:
  642.  
  643.                                    d = Dir,   result or dir-block display
  644.                                    b = Bad,   result of 'scan' command
  645.                                    f = Find,  result of 'f' command
  646.                                    m = Mem,   result of 'mem' commands
  647.  
  648.                 opts    optional   + = Use verbose output, one line per LSN
  649.                                    f = Incluse PATH info on Fnode LSN's on
  650.                                        verbose output (requires + too)
  651.  
  652.  Output:        List of sector numbers in compact or verbose format
  653.  
  654.  Remarks:       The default list-identifier will be set to a specific list
  655.                 each-time one of the lists is modified or listed.
  656.                 List also available for REXX in the dfs_sn. stem variable
  657.  
  658.  
  659.  mem  [c|lsn][#] = Memory list of LSN's clear or update
  660.  
  661.  Purpose:       Add an LSN to the LSN memory list for later use with .NNN
  662.  
  663.  Parameters:    c       optional   Clear command, limit list-size to # entries
  664.  
  665.                 lsn     optional   LSN to add to the list, special values are:
  666.                                    x, u, d, t for Xtra, Up, Down and This
  667.  
  668.                 #       optional   memory location to store lsn, or limit
  669.  
  670.  Output:        none
  671.  
  672.  Remarks:       The LSN memory can be listed using "list m" [+f]
  673.  
  674.  
  675.  .NNN        [id] = Display numbered FS-entity marked .NNN from a sector list
  676.  
  677.  Purpose:       Display one of the entries from the list last shown
  678.                 It can be applied on Directory- as well as Allocation-lists
  679.                 The number (NNN) to use is displayed to the left of the list
  680.  
  681.  Parameters:    NNN                The zero-based decimal entry number to show
  682.  
  683.                 id      optional   Identifier for LSN list (see list command)
  684.  
  685.  Output:        Sector display, format selected based on sector-contents
  686.                                                                               
  687.  
  688.  
  689.  Enter        = down in hierachy (Enter = down)
  690.  
  691.  Purpose:       Display the next, most likely wanted, sector
  692.  
  693.  Parameters:    none
  694.  
  695.  Output:        Sector display, format selected based on sector-contents
  696.  
  697.  Remarks:
  698.  
  699.  
  700.  
  701.  u            = up in hierachy
  702.  
  703.  Purpose:       Display the sector that is higher in the hierarchy (parent)
  704.  
  705.  Parameters:    none
  706.  
  707.  Output:        Sector display, format selected based on sector-contents
  708.  
  709.  
  710.  
  711.  x            = Extra LSN
  712.  
  713.  Purpose:       Display the sector marked as eXtra
  714.  
  715.  Parameters:    none
  716.  
  717.  Output:        Sector display, format selected based on sector-contents
  718.  
  719.  Remarks:
  720.                                                                               
  721.  
  722.  SLT [t i s m]   = Show SLT for 'type', at index i, size s, error-mask m
  723.  
  724.  Purpose:       Display (selection of) the Sector Lookup Table
  725.  
  726.  Parameters:    t       optional   Sector-types to include in the displayed
  727.                                    list. Default is all types ('*')
  728.                                    Types are same as specified for 'f' cmd
  729.  
  730.                 i       optional   Start index in the SLT to display
  731.  
  732.                 s       optional   Number of entries to display, default
  733.                                    will result in one screen-full
  734.  
  735.                 m       optional   Error filtering mask, * = all errors
  736.                                    4-digit Hexadecimal value, each set bit
  737.                                    will include a specific error value.
  738.  
  739.  
  740.  Output:        One line for each entry in the SLT, containing:
  741.                         LSN        Start LSN for a range of sectors
  742.                         size       Number of sectors in the range
  743.                         ref        Other sector refering to this range (fnode)
  744.                         type       Type of the sectors in the range
  745.                         error      4-digit Hexadecimal error value:
  746.  
  747.                            0x0001  Linked to some structure, but not in bitmap
  748.                            0x0002  Allocated in bitmap, but not linked
  749.                            0x0008  Fnode is a directory but DirFlag is not set
  750.                            0x0010  Fnode datalength greater than Dir-entry size
  751.                            0x0020  Fnode datalength smaller than Dir-entry size
  752.                            0x0040  Fnode datalength greater than allocated size
  753.                            0x0080  Fnode datalength smaller than allocated size
  754.  
  755.  Remarks:       Sector ranges might overlap, the smallest matching range will
  756.                 hold the best identification for a specific sector.
  757.  
  758.                 The start-index will default to the position of the sector
  759.                 last searched using the 'i' cmd.
  760.  
  761.                 If needed the SLT will be built in a background thread.
  762.  
  763.  
  764.  id [xx]      = Identify, using sector lookup table
  765.  
  766.  Purpose:       Display the type for a specific sector and one major reference
  767.  
  768.  Parameters:    xx      optional   LSN of sector to identify, default is
  769.                                    the current sector
  770.  
  771.  Output:        One line specifying corresponding SLT entry, followed by
  772.                 a line specifying the type of the sector itself and a
  773.                 sector display of the 'ref' sector, in a format based
  774.                 on sector-contents
  775.  
  776.  Remarks:       Sector ranges might overlap, the smallest matching range will
  777.                 be considered best.
  778.  
  779.                 This function is extremely usefull to relate file-data sectors
  780.                 from fragmented files to the Fnode for the file.
  781.                 It will tell you exactly to wich file a certain sector belongs.
  782.                                                                               
  783.  log       [file] = Log (append) to 'file' (.log); (No file => stop logging)
  784.  
  785.  Purpose:       Close current LOG, open new and capture DFS output in it
  786.  
  787.  Parameters:    File specification
  788.                 If no parameter is specified, logging is stopped.
  789.  
  790.  Output:        Concatenated output of DFS commands given after the
  791.                 'log' command, upto next 'log' or 'q' command.
  792.                 ANSI control characters for colors and cursor-positioning
  793.                 are not written to the logfile.
  794.  
  795.  Remarks:       There is no check on available space on the destination
  796.                 drive, file may end up empty if disk(ette) is full.
  797.                 The same logfile specification can be used more than once,
  798.                 output will be concatenated.
  799.                 On each 'log' command the current logfile will be closed.
  800.  
  801.  
  802.  trace [lvl]  = Set trace level for DFS internal functions
  803.  
  804.  Purpose:       Investigate unexpected behaviour and debug DFS
  805.  
  806.  Parameters:    lvl     optional   Trace level; 0 = no trace
  807.  
  808.  Output:        The resulting trace-level, after this the output will be
  809.                 normal output mixed with extra trace information showing
  810.                 API return-codes and DFS internal variables
  811.  
  812.  Remarks:       Only available in the special DFSTRACE.EXE version
  813.  
  814.  
  815.  prio  [lvl]  = Set relative priority of the DFS main thread
  816.  
  817.  Purpose:       Increase (search) speed with +, or decrease system impact
  818.  
  819.  Parameters:    lvl     optional   Prority level; + and ++ = high(est),
  820.                                                   - and -- = low(est)
  821.  
  822.  Output:        The resulting prio-level
  823.  
  824.  Remarks:       When running on low(est) priority in the background, DFS
  825.                 will almost come to a halt.
  826.  
  827.  q                = Quit FS display; 2.36 20-08-97  (c) 1994-1997; Jan van Wijk
  828.  
  829.  Purpose:       Exit DFS program
  830.  
  831.  Remarks:       Opened physical disk and logfile will be closed on exit
  832.                 Asynchronious running threads will be aborted.
  833.  
  834.  
  835.  cd [path]    = Change current Directory
  836.  
  837.  Purpose:       Change both the current directory and the current drive
  838.  
  839.  Parameters:    path    optional   Absolute or relative path specification
  840.  
  841.  Output:        The resulting current drive and directory
  842.  
  843.  Remarks:       '.' and '..' can be used in the relative path specification
  844.                                                                               
  845.  run mf [arg] = Run a REXX macro from DFS
  846.  
  847.  Purpose:       Execute a REXX script using the 'DFS' environment
  848.  
  849.  Parameters:    mf      mandatory  Macro file specification
  850.  
  851.                 arg     optional   Arguments to the REXX macro
  852.  
  853.  Output:        Any output from the REXX macro including (OS/2) commands
  854.                 executed from the macro.
  855.  
  856.  Remarks:       DFS commands can be issued from within the macro, this
  857.                 is the default environment (Address DFS).
  858.                 Commands for CMD.EXE must be addressed using 'Address Cmd'
  859.  
  860.                 The following REXX variables will be available after
  861.                 each executed DFS command from a macro:
  862.  
  863.                 rc            The returncode from the DFS command
  864.  
  865.                 dfs_disknr    Physical disk number currently open
  866.                 dfs_partid    Partition-id for selection with "part"
  867.                 dfs_drive     The opened drive letter, including a colon.
  868.                 dfs_afsys     The attached filesystem, like "HPFS" or "FAT"
  869.                 dfs_sect      The last retrieved sector(s), binary buffer
  870.                 dfs_type      Type of last retrieved sector, this is a string
  871.                               starting with the type-character (see 'F' cmd)
  872.                               followed by a textual description.
  873.  
  874.                 dfs_this      SN of the last retrieved sector
  875.                 dfs_down      SN of most likely sector to retrieve now
  876.                 dfs_up        SN of sector up in hierarchy
  877.                 dfs_next      SN of next in sequence
  878.                 dfs_prev      SN of previous in sequence
  879.                 dfs_down      SN of up in hierarchy
  880.  
  881.                 dfs_sn.0      Number of sector-numbers in the SN stem variable
  882.                 dfs_sn.n      nth sector-number in the SN stem variable, coming
  883.                               from DFS output for directories and allocation.
  884.                               They correspond to the '.NNN' command
  885.  
  886.                               Note: SN's are in an 8-digit Hexadecimal format
  887.  
  888.                 The number of disks and partitions can be resolved using the
  889.                 returncode (rc) from the commands "disk 0" and "part 0" or
  890.                 "part" respectively.
  891.  
  892.                 REXX is dynamically loaded, when the run-command is exectuted
  893.                 It requires REXX.DLL and REXXAPI.DLL in the libpath.
  894.  
  895.  
  896.  copyoutput [stem-name]      Copy output from last-command to REXX stem-var
  897.  
  898.  Purpose:       Allow output to be captured and processed from REXX
  899.  
  900.  Parameters:    stem    optional   name of stem variable, ending in a '.'
  901.                         default:   "dfs_output."
  902.  
  903.  Output:        none
  904.  
  905.  Remarks:       The <stem>.0 will hold the number of lines
  906.                 <stem>.1 through <stem>.n the actual cmd-output
  907.                                                                               
  908.  
  909.  scan [wr [NoId]] = Scan bad-sectors; use read/Write verify; No automatic id
  910.  
  911.  Purpose:       Identify bad sectors on a physical disk or logical volume
  912.  
  913.  Parameters:    write   optional   'w' to use full read/write/verify sequence
  914.  
  915.                 NoId    optional   'n' to disable automatic SLT lookup
  916.  
  917.  Output:        Progress indication based on sector-numbers, and one line for
  918.                 each bad-sector found, plus an SLT display of a related sector
  919.                 like the fnode, if automatic SLT display is enabled.
  920.  
  921.  Remarks:       For REXX, the dfs_sn.0 stem variable will hold the number of
  922.                 bad-sectors found and dfs_sn.1 through dfs_sn.n the actual
  923.                 bad sector numbers (can be shown with the 'list' command)
  924.  
  925.                 Without the write option, only a single 'read' will be done
  926.                 for each sector, this can be executed on a running system
  927.                 with open files on the disk/volume to be checked.
  928.  
  929.                 With the write option a "read/write-inverse/read/write-normal"
  930.                 sequence is done for each sector with contents checking.
  931.                 The contents of each sector will stay the same, so the function
  932.                 can be safely executed on formatted disks with live data.
  933.                 This sequence takes at least 4 times more time to complete
  934.                 and also, for safety, the disk will be locked. This means that
  935.                 the write option can only be used when the complete physical
  936.                 disk is not being used.
  937.  
  938.  Remarks:       Also available for REXX in the dfs_sn. stem variable
  939.  
  940.  
  941.  screen [arg] = Switch output to the screen on or off
  942.  
  943.  Purpose:       Allow output to logfile only
  944.  
  945.  Parameters:    arg     optional   'on' or 'off' to switch mode
  946.  
  947.  Output:        none
  948.  
  949.  Remarks:       The returncode (rc from REXX) will indicate the setting for
  950.                 screen output: 0 indicates screen switched on
  951.                                1 indicates screen switched off
  952.                                                                               
  953. Command reference, HPFS specific commands
  954. -----------------------------------------
  955.  
  956. Active filesystem : HPFS, specific commands are:
  957.  
  958.  alloc  [+]      = Show data-band allocation bitmaps, compact or [+] verbose
  959.  dirmap          = Show directory band allocation and usage map
  960.  bitmap [xx,s,D] = Show bitmap at LSN xx, size s, in alloc or [D]ir format
  961.  find path-spec  = Find and show file/directory specified by path-spec,
  962.                    relative to current dir, or root if starting with '\'
  963.  \path-spec      = find and show file/directory relative to root
  964.  path     [n]    = Show all path-components for current fnode, upto root
  965.  autobase [t][l] = find the start of an HPFS partition by searching sectors
  966.                    of types [t], default 'spad'; [l] is last valid sector
  967.  findroot [n]    = find the Root directory without using the superblock
  968.                    starting the search at LSN [n]
  969.  fixroot         = Update superblock with found LSN for root-directory
  970.  fixcp           = Update superblock with found LSN for codepage info
  971.  saveto [dir][l] = Save filedata connected to (current) fnode to a file
  972.  ca   [lsn][opt] = Check Allocation for (current) fnode lsn
  973.  
  974.  For an up-to-date list of commands, use the '??' command
  975.  
  976.  
  977.  
  978.  
  979.  autobase [t][l] = find the start of an HPFS partition by searching sectors
  980.  
  981.  Purpose:       Force a different partition start sector-nr for HPFS partition
  982.  
  983.  Parameters:    t       One or more sector-types to use in the search
  984.                         default is "spad", Super, Spare, Alloc and Dirblock
  985.                         f for fnode can also be used but is less reliable
  986.                 sl      Sector-number to use as end for partition (optional)
  987.  
  988.  Output:        Search progress and finel result when HPFS partition found
  989.  
  990.  Remarks:       Can be used if start of partition / partition-tables are bad
  991.                 Use the "fs hpfs" command first!
  992.                                                                               
  993.  
  994.  
  995.  alloc  [+]      = Show data-band allocation bitmaps, compact or [+] verbose
  996.  
  997.  Purpose:       Show usage and the distribution of data over the volume.
  998.  
  999.  Parameters:    none
  1000.  
  1001.  Output:        A single bitmap-graphic for the entire volume or for each
  1002.                 allocation-band when verbose format is selected
  1003.  
  1004.  Remarks:       System-reserved and Directory-band are indicated with 'S'
  1005.                 and 'R' respectively. Other area's are filled in according
  1006.                 to the degree of usage (allocation)
  1007.  
  1008.  
  1009.  dirmap          = Show directory band allocation and usage map
  1010.  
  1011.  Purpose:       Show usage of the pre-allocated directory-band
  1012.  
  1013.  Parameters:    none
  1014.  
  1015.  Output:        A single bitmap-graphic showing the allocation of the
  1016.                 pre-allocated directory band.
  1017.  
  1018.  Remarks:       If 100% is allocated more directory information will be
  1019.                 allocated elsewhere on the volume.
  1020.  
  1021.  bitmap [xx s D] = Show bitmap at LSN xx, size s, in alloc or [D]ir format
  1022.  
  1023.  Purpose:       Show a bitmape located at specified LSN, alloc or DIR format
  1024.  
  1025.  Parameters:    xx      mandatory  LSN of a bitmap sector
  1026.  
  1027.                 s       optional   size to dump:  1..63   specifies sectors
  1028.                                                  64..xxx  specifies bytes
  1029.                                    Default is 4 sectors (default bitmap size)
  1030.  
  1031.                 D       optional   Directory-format flag
  1032.  
  1033.  Output:        One bitmap-graphic for the specified bitmap LSN.
  1034.  
  1035.  Remarks:       Specifying an LSN that is not a bitmap-LSN will result in
  1036.                 a garbage bitmap display.
  1037.                                                                               
  1038.  
  1039.  \path-spec      = find and show file/directory specified by path-spec
  1040.  
  1041.  Purpose:       Locate the fnode for a known file- or directory
  1042.  
  1043.  Parameters:    path-spec          full path specification with no intervening
  1044.                                    space after the '\' command character
  1045.  
  1046.                               or   absolute- or relative path specification
  1047.                                    with an intervening space. If the path
  1048.                                    does not start with a '\' it is relative
  1049.                                    to the current directory (see CD cmd).
  1050.  
  1051.  Output:        Searchlist starting at the ROOT directory upto the requested
  1052.                 file or directory. It is either followed by an error message
  1053.                 if the path-spec was not found or by the display of the
  1054.                 corresponding fnode information.
  1055.  
  1056.  Remarks:       The search algorithm depends on the ROOT fnode being known.
  1057.                 When the superblock is corrupt this fnode can be resolved
  1058.                 using the 'findroot' command.
  1059.  
  1060.  
  1061.  
  1062.  path     [n]    = Show all path-components for current fnode, upto root
  1063.  
  1064.  Purpose:       Show the directory-branch that contains current file/dir
  1065.  
  1066.  Parameters:    n           optional   Start LSN for the search
  1067.  
  1068.  Output:        One line for each found 'parent' directory, upto the root
  1069.  
  1070.  Remarks:
  1071.  
  1072.  
  1073.  ca   [lsn][opt] = Check Allocation for (current) fnode lsn
  1074.  
  1075.  Purpose:       Check allocation integrity for current fnode
  1076.  
  1077.  Parameters:    lsn         optional   LSN of the fnode
  1078.                 opt         optional   Options:  v   = Verbose, show progress
  1079.  
  1080.  Output:        Σ           Start of an allocation-sector (heavily fragmented)
  1081.                 »           Start of one file-extent (fragmented file)
  1082.                 ·           One sector, green small dot is allocation OK
  1083.                 ■           One sector, red big dot is allocation error
  1084.  
  1085.                 Also a summary is given with the number of (failed) sectors
  1086.  
  1087.  Remarks:       Fnode maybe for a regular file (sectors must be ALLOCATED)
  1088.                 or for a deleted file (sectors must be FREE)
  1089.  
  1090.                                                                               
  1091.  findroot [n]    = find the Root directory without using the superblock
  1092.  
  1093.  Purpose:       Find the fnode for the ROOT directory, even if parts of
  1094.                 the volume, including the superblock, are damaged.
  1095.  
  1096.  Parameters:    n           optional   Start LSN for the search
  1097.  
  1098.  Output:        Search-list starting at the first fnode encountered upto
  1099.                 the fnode for the ROOT directory when found.
  1100.  
  1101.  Remarks:       Specifying a startlsn might be needed if reading at the
  1102.                 start of the volume results in device errors, or if some
  1103.                 fnodes in the sequence are corrupted.
  1104.  
  1105.  
  1106.  fixroot         = Write the root-LSN found with the 'findroot' command back
  1107.  
  1108.  Purpose:       Fix bad Root-LSN pointer, caused by CHKDSK bugs or
  1109.                 other corruption
  1110.  
  1111.  Parameters:    none
  1112.  
  1113.  Output:        none
  1114.  
  1115.  Remarks:       It is better to lock the physical before writing to it
  1116.                 See 'lock' and 'unlock' commands
  1117.  
  1118.  
  1119.  fixcp           = Write the CodePage-LSN found with the '0#f c' command back
  1120.  
  1121.  Purpose:       Fix bad CodePage-LSN pointer, caused by CHKDSK bugs or
  1122.                 other corruption
  1123.  
  1124.  Parameters:    none
  1125.  
  1126.  Output:        none
  1127.  
  1128.  Remarks:       It is better to lock the physical before writing to it
  1129.                 See 'lock' and 'unlock' commands
  1130.  
  1131.  
  1132.  saveto [dir][l] = Save filedata connected to (current) fnode to a file
  1133.  
  1134.  Purpose:       Recover a file if the fnode can still be found, by making
  1135.                 a low-level sector-by-sector copy of its data to a new file.
  1136.                 (basic functionality to be used for undelete operations)
  1137.  
  1138.  Parameters:    dir         optional   Path to save the file copy (existing!)
  1139.  
  1140.                 l           optional   LSN of the fnode of the file to recover
  1141.                                        default is the current LSN (This)
  1142.  
  1143.  Output:        Progress is reported with output like the "ca" command,
  1144.                 error messages will be given as appropriate
  1145.  
  1146.  Remarks:       Only the file contents is recovered, date&time, attributes
  1147.                 and extended attributes are lost.
  1148.  
  1149.                 If no directory is specified it will default to the last
  1150.                 directory given, or "A:" when it is the first time
  1151.                                                                               
  1152. Diagram of an example HPFS structure
  1153.  
  1154.  Basic HPFS data-structure for Root-directory with AUTOEXEC.BAT, README file,
  1155.  an OS2 subdirectory and lots of other files. The README file has it's data
  1156.  allocated in 2 alloc-chunks.
  1157.  
  1158.  ╔═════════╗                  ╔══════════════════╗       ╔═══════╗
  1159.  ║SUPER    ║              ┌──>║ DIR block        ║   ┌──>║ FNODE ║
  1160.  ║         ║              │   ║                  ║   │   ║       ║
  1161.  ║         ║    ╔═══════╗ │   ║┌────────────────┐║   │   ║       ║  ╔══════════
  1162.  ║Root LSN ────>║ FNODE ║ │   ║│*Special**Start*│║   │   ║ ALLOC ──>║ DIR block
  1163.  ╚═════════╝    ║       ║ │   ║│entry FNODE  LSN│║   │   ╚═══════╝  ║
  1164.                 ║       ║ │   ║│BtreeDownPtr LSN│║   │              ║┌─────────
  1165.                 ║ ALLOC ──┘   ║└────────────────┘║   │              ║│8514.RC
  1166.                 ╚═══════╝     ║┌────────────────┐║   │              ║│entry FNO
  1167.                               ║│OS2 (subdir)    │║   │              ║│BtreeDown
  1168.                               ║│entry FNODE  LSN├────┘              ║└─────────
  1169.  ┌─────────────────────────────┤BtreeDownPtr LSN│║                  ║┌─────────
  1170.  │                            ║└────────────────┘║                  ║│ANSI.EXE
  1171.  │                            ║┌────────────────┐║
  1172.  │                            ║│Special-end     │║
  1173.  │  ╔══════════════════╗      ║│entry FNODE  LSN│║       ╔══════════════════╗
  1174.  └─>║ DIR block        ║      ║│BtreeDownPtr LSN├───────>║ DIR block        ║
  1175.     ║┌────────────────┐║      ║└────────────────┘║       ║┌────────────────┐║
  1176.     ║│*Special**Start*│║      ╚══════════════════╝       ║│*Special**Start*│║
  1177.     ║│entry FNODE  LSN│║                                 ║│entry FNODE  LSN│║
  1178.     ║│BtreeDownPtr LSN│║     ╔═══════╗                   ║│BtreeDownPtr LSN│║
  1179.     ║└────────────────┘║  ┌─>║ FNODE ║                   ║└────────────────┘║
  1180.     ║┌────────────────┐║  │  ║       ║                   ║┌────────────────┐║
  1181.     ║│AUTOEXEC.BAT    │║  │  ║       ║  ╔═══════════     ║│PP... filename  │║
  1182.     ║│entry FNODE  LSN├───┘  ║ ALLOC ──>║┌──────────     ║│entry FNODE  LSN│║
  1183.     ║│BtreeDownPtr LSN│║     ╚═══════╝  ║│ 1st data-     ║│BtreeDownPtr LSN│║
  1184.     ║└────────────────┘║                ║└──────────     ║└────────────────┘║
  1185.     ║┌────────────────┐║                                 ║┌────────────────┐║
  1186.     ║│OS1.. filename  │║                                 ║│README filename │║
  1187.     ║│entry FNODE  LSN│║      ┌───────────────────────────┤entry FNODE  LSN│║
  1188.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  1189.     ║└────────────────┘║      │                          ║└────────────────┘║
  1190.     ║┌────────────────┐║      │                          ║┌────────────────┐║
  1191.     ║│**Special**End**│║      │                          ║│XXX... filename │║
  1192.     ║│entry FNODE  LSN│║      │                          ║│entry FNODE  LSN│║
  1193.     ║│BtreeDownPtr LSN│║      │                          ║│BtreeDownPtr LSN│║
  1194.     ║└────────────────┘║      │                          ║└────────────────┘║
  1195.     ╚══════════════════╝      │                          ║┌────────────────┐║
  1196.                               │                          ║│**Special**End**│║
  1197.                               │                          ║│entry FNODE  LSN│║
  1198.                               │                          ║│BtreeDownPtr LSN│║
  1199.                               │                          ║└────────────────┘║
  1200.                               │                          ╚══════════════════╝
  1201.                               │
  1202.                               │                    ╔════════════════════════╗
  1203.                               │               ┌───>║┌──────────────────────┐║
  1204.                               │               │    ║│ 1st data-sector      │║
  1205.                               │               │    ║└──────────────────────┘║
  1206.                               │               │    ║┌──────────────────────┐║
  1207.                               │  ╔═══════╗    │    ║│ 2nd data-sector      │║
  1208.                               └─>║ FNODE ║    │    ║└──────────────────────┘║
  1209.                                  ║       ║    │    ╚════════════════════════╝
  1210.                                  ║       ─────┘
  1211.                                  ║ ALLOC ║         ╔════════════════════════╗
  1212.                                  ║       ─────────>║┌──────────────────────┐║
  1213.                                  ╚═══════╝         ║│ 3rd data-sector      │║
  1214.                                                    ║└──────────────────────┘║
  1215.     (c) 1995                                       ║┌──────────────────────┐║
  1216.     J. v. Wijk                                     ║│ 4th data-
  1217.                                                                               
  1218.  
  1219. Examples of DFS usage
  1220. ---------------------
  1221.  
  1222.  1) Resolve original name of FILExxxx.CHK files (created by CHKDSK)
  1223.  
  1224.     When CHKDSK recovers files it will place in a FOUND.xxx directory in
  1225.     the root-directory. This directory contains one or more recovered files
  1226.     with names like FILE0001.CHK
  1227.  
  1228.     The original name of the file is still in the Fnode, it can be shown
  1229.     using the following dhpfs commands (assuming drive c:) :
  1230.  
  1231.     Command                            Explanation
  1232.  
  1233.     DFS disks                          Start DFS and scan physical disks
  1234.     part id                            Select partition 'id' (must be HPFS)
  1235.     \found.000\file0001.chk            Search and display Fnode for .CHK
  1236.  
  1237.     Now 15 characters of the original name are shown as "Fnode Name String"
  1238.  
  1239.  2) Show freespace area's (HPFS)
  1240.  
  1241.     slt $
  1242.  
  1243.  3) Undelete a file; Find the fnode using:
  1244.  
  1245.       "f z"               find the next deleted fnode
  1246.       "f z   shortname"   next deleted named shortname (case-sensitive)
  1247.       "f$@ z shortname"   next deleted named shortname (case-insensitive)
  1248.  
  1249.       Add a '*' to the find command to do a repeated search (see 'f' command)
  1250.  
  1251.     Then use the "saveto path" command to copy the data for the deleted
  1252.     file to a directory.
  1253.  
  1254.     Notes: - It's best to use a different drive to avoid overwriting
  1255.  
  1256.  4) Save and restore (parts of) a disk
  1257.  
  1258.     The "sim" command can be used to save a complete disk, including partition
  1259.     information to one (very large!) file on a different (network) drive.
  1260.     The save the entire unit (opened disk/partition or volume) use:
  1261.     "sim img-name 0 $"
  1262.  
  1263.     It can be restored using the "wrim" command, if and only if the destination
  1264.     disk has exactly the same geometry as the source disk (heads, sectors cyl).
  1265.  
  1266.     This could be used to clone one workstation to multiple machines.
  1267.  
  1268.  
  1269.  4) List all "undeletable" files
  1270.  
  1271.     Find the FNODES for possibly deleted files using
  1272.  
  1273.       "f* z" or for specific files:  "f*$@ z shortname"
  1274.  
  1275.     Now list them, including PATH and recovery reliability using:
  1276.  
  1277.       "list f+f"
  1278.                                                                               
  1279.  
  1280. Known limitations and bugs
  1281. --------------------------
  1282.  
  1283. - There is no real support for FAT, NTFS yet besides basic recognition.
  1284.  
  1285. - saveto only save the basic file-data, no extended attributes yet
  1286.  
  1287.  
  1288.  
  1289. Considered improvements
  1290. -----------------------
  1291.  
  1292.  Automatic detection of inconsistencies (like CHKDSK, FST, HVA and CHKPART)
  1293.  
  1294.    This will show HPFS problems like CHKDSK does, but in more detail and
  1295.    maybe some more types of inconsistencies.
  1296.    Note: Basic HPFS functionality implemented in version 1.62
  1297.          Some partitioning errors implemented in version 1.82
  1298.  
  1299.  
  1300.  Real coverage of other file-systems besides HPFS like FAT, LINUX, NTFS ...
  1301.    The code has been prepared for other file-systems in version 2.21
  1302.  
  1303.  Graphical User Interface
  1304.  
  1305.    This could make the program easier to use, however it also makes
  1306.    the program requirements less attractive becaus it uses PM/WPS
  1307.    or WINxx and makes porting more difficult.
  1308.    A command-line version will allways be available to allow operation
  1309.    from a minimal (diskette) system.
  1310.  
  1311.  
  1312.  Write capability,
  1313.  
  1314.    This will allow recovery operations without using other (third-party)
  1315.    utilities. This will require locking the entire disk so usage is
  1316.    often limited to diskette BOOT.
  1317.  
  1318.    Note: Some write enabled commands have been implemented starting with 1.90
  1319.          Improved volume/disk locking implemented in version 2.25
  1320.  
  1321.  
  1322.  Update of HPFS internal bad-sector list after a DFS 'scan' command
  1323.  
  1324.    This is a low-priority item, disks with many bad-sectors are doomed anyway
  1325.  
  1326.  
  1327.  Recovery for deleted files (undelete), basics implemented in 2.30
  1328.  
  1329.  Recovery for a 'quick format' on HPFS (unformat)
  1330.  
  1331.  Recovery for repartitioning (un-fdisk)
  1332.  
  1333.